#!/usr/bin/env python
# coding=utf-8

import os
import sys

if (len(sys.argv) <= 1):
    exit ("not enough args, ex. " + sys.argv[0] + " 5.6-c1")
else:
    postfix = sys.argv[1]

# co source
ret = os.system("./autoco.py")
if (ret != 0):
	exit(-1)
    
# switch
ret = os.system("./autoswitch.py")
if (ret != 0):
	exit(-1)
	
# save profile
os.system("mkdir -p profiles")
ret = os.system("cp svnlist.txt " + "profiles/BaiduBrowser-" + postfix + ".txt")
if (ret != 0):
	print "Profile save failed"
	exit(-1)
else:
	print "Profile saved to " + "profiles/BaiduBrowser-" + postfix + ".txt"